/*******************************************************************************
 * Copyright (c) 2015 Soyatec and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Soyatec - initial API and implementation
 *******************************************************************************/
/**
 */
package org.soyatec.tooling.di.util;

import java.util.Map;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.util.Switch;
import org.soyatec.tooling.di.Alignment;
import org.soyatec.tooling.di.Comment;
import org.soyatec.tooling.di.CommentLink;
import org.soyatec.tooling.di.Connector;
import org.soyatec.tooling.di.Container;
import org.soyatec.tooling.di.DiPackage;
import org.soyatec.tooling.di.Diagram;
import org.soyatec.tooling.di.GradientShape;
import org.soyatec.tooling.di.Grid;
import org.soyatec.tooling.di.Guide;
import org.soyatec.tooling.di.Line;
import org.soyatec.tooling.di.Node;
import org.soyatec.tooling.di.Ruler;
import org.soyatec.tooling.di.Shape;
import org.soyatec.tooling.di.View;

/**
 * <!-- begin-user-doc --> The <b>Switch</b> for the model's inheritance
 * hierarchy. It supports the call {@link #doSwitch(EObject) doSwitch(object)}
 * to invoke the <code>caseXXX</code> method for each class of the model,
 * starting with the actual class of the object and proceeding up the
 * inheritance hierarchy until a non-null result is returned, which is the
 * result of the switch. <!-- end-user-doc -->
 *
 * @see org.soyatec.tooling.di.DiPackage
 * @generated
 */
public class DiSwitch<T> extends Switch<T> {
    /**
     * The cached model package <!-- begin-user-doc --> <!-- end-user-doc -->
     *
     * @generated
     */
    protected static DiPackage modelPackage;

    /**
     * Creates an instance of the switch. <!-- begin-user-doc --> <!--
     * end-user-doc -->
     *
     * @generated
     */
    public DiSwitch() {
        if (modelPackage == null) {
            modelPackage = DiPackage.eINSTANCE;
        }
    }

    /**
     * Checks whether this is a switch for the given package. <!--
     * begin-user-doc --> <!-- end-user-doc -->
     *
     * @parameter ePackage the package in question.
     * @return whether this is a switch for the given package.
     * @generated
     */
    @Override
    protected boolean isSwitchFor(final EPackage ePackage) {
        return ePackage == modelPackage;
    }

    /**
     * Calls <code>caseXXX</code> for each class of the model until one returns
     * a non null result; it yields that result. <!-- begin-user-doc --> <!--
     * end-user-doc -->
     *
     * @return the first non-null result returned by a <code>caseXXX</code>
     *         call.
     * @generated
     */
    @Override
    protected T doSwitch(final int classifierID, final EObject theEObject) {
        switch (classifierID) {
        case DiPackage.VIEW: {
            final View view = (View) theEObject;
            T result = caseView(view);
            if (result == null) {
                result = defaultCase(theEObject);
            }
            return result;
        }
        case DiPackage.NODE: {
            final Node node = (Node) theEObject;
            T result = caseNode(node);
            if (result == null) {
                result = caseView(node);
            }
            if (result == null) {
                result = defaultCase(theEObject);
            }
            return result;
        }
        case DiPackage.CONTAINER: {
            final Container container = (Container) theEObject;
            T result = caseContainer(container);
            if (result == null) {
                result = caseView(container);
            }
            if (result == null) {
                result = defaultCase(theEObject);
            }
            return result;
        }
        case DiPackage.DIAGRAM: {
            final Diagram diagram = (Diagram) theEObject;
            T result = caseDiagram(diagram);
            if (result == null) {
                result = caseContainer(diagram);
            }
            if (result == null) {
                result = caseView(diagram);
            }
            if (result == null) {
                result = defaultCase(theEObject);
            }
            return result;
        }
        case DiPackage.SHAPE: {
            final Shape shape = (Shape) theEObject;
            T result = caseShape(shape);
            if (result == null) {
                result = caseContainer(shape);
            }
            if (result == null) {
                result = caseNode(shape);
            }
            if (result == null) {
                result = caseView(shape);
            }
            if (result == null) {
                result = defaultCase(theEObject);
            }
            return result;
        }
        case DiPackage.GRADIENT_SHAPE: {
            final GradientShape gradientShape = (GradientShape) theEObject;
            T result = caseGradientShape(gradientShape);
            if (result == null) {
                result = caseShape(gradientShape);
            }
            if (result == null) {
                result = caseContainer(gradientShape);
            }
            if (result == null) {
                result = caseNode(gradientShape);
            }
            if (result == null) {
                result = caseView(gradientShape);
            }
            if (result == null) {
                result = defaultCase(theEObject);
            }
            return result;
        }
        case DiPackage.LINE: {
            final Line line = (Line) theEObject;
            T result = caseLine(line);
            if (result == null) {
                result = caseNode(line);
            }
            if (result == null) {
                result = caseView(line);
            }
            if (result == null) {
                result = defaultCase(theEObject);
            }
            return result;
        }
        case DiPackage.CONNECTOR: {
            final Connector connector = (Connector) theEObject;
            T result = caseConnector(connector);
            if (result == null) {
                result = caseLine(connector);
            }
            if (result == null) {
                result = caseNode(connector);
            }
            if (result == null) {
                result = caseView(connector);
            }
            if (result == null) {
                result = defaultCase(theEObject);
            }
            return result;
        }
        case DiPackage.COMMENT: {
            final Comment comment = (Comment) theEObject;
            T result = caseComment(comment);
            if (result == null) {
                result = caseShape(comment);
            }
            if (result == null) {
                result = caseContainer(comment);
            }
            if (result == null) {
                result = caseNode(comment);
            }
            if (result == null) {
                result = caseView(comment);
            }
            if (result == null) {
                result = defaultCase(theEObject);
            }
            return result;
        }
        case DiPackage.COMMENT_LINK: {
            final CommentLink commentLink = (CommentLink) theEObject;
            T result = caseCommentLink(commentLink);
            if (result == null) {
                result = caseLine(commentLink);
            }
            if (result == null) {
                result = caseNode(commentLink);
            }
            if (result == null) {
                result = caseView(commentLink);
            }
            if (result == null) {
                result = defaultCase(theEObject);
            }
            return result;
        }
        case DiPackage.GRID: {
            final Grid grid = (Grid) theEObject;
            T result = caseGrid(grid);
            if (result == null) {
                result = defaultCase(theEObject);
            }
            return result;
        }
        case DiPackage.RULER: {
            final Ruler ruler = (Ruler) theEObject;
            T result = caseRuler(ruler);
            if (result == null) {
                result = defaultCase(theEObject);
            }
            return result;
        }
        case DiPackage.GUIDE: {
            final Guide guide = (Guide) theEObject;
            T result = caseGuide(guide);
            if (result == null) {
                result = defaultCase(theEObject);
            }
            return result;
        }
        case DiPackage.ELEMENT_ENTRY: {
            @SuppressWarnings("unchecked")
            final Map.Entry<View, Alignment> elementEntry = (Map.Entry<View, Alignment>) theEObject;
            T result = caseElementEntry(elementEntry);
            if (result == null) {
                result = defaultCase(theEObject);
            }
            return result;
        }
        default:
            return defaultCase(theEObject);
        }
    }

    /**
     * Returns the result of interpreting the object as an instance of '
     * <em>View</em>'. <!-- begin-user-doc --> This implementation returns null;
     * returning a non-null result will terminate the switch. <!-- end-user-doc
     * -->
     *
     * @param object
     *            the target of the switch.
     * @return the result of interpreting the object as an instance of '
     *         <em>View</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseView(final View object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '
     * <em>Node</em>'. <!-- begin-user-doc --> This implementation returns null;
     * returning a non-null result will terminate the switch. <!-- end-user-doc
     * -->
     *
     * @param object
     *            the target of the switch.
     * @return the result of interpreting the object as an instance of '
     *         <em>Node</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseNode(final Node object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '
     * <em>Container</em>'. <!-- begin-user-doc --> This implementation returns
     * null; returning a non-null result will terminate the switch. <!--
     * end-user-doc -->
     *
     * @param object
     *            the target of the switch.
     * @return the result of interpreting the object as an instance of '
     *         <em>Container</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseContainer(final Container object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '
     * <em>Diagram</em>'. <!-- begin-user-doc --> This implementation returns
     * null; returning a non-null result will terminate the switch. <!--
     * end-user-doc -->
     *
     * @param object
     *            the target of the switch.
     * @return the result of interpreting the object as an instance of '
     *         <em>Diagram</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseDiagram(final Diagram object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '
     * <em>Shape</em>'. <!-- begin-user-doc --> This implementation returns
     * null; returning a non-null result will terminate the switch. <!--
     * end-user-doc -->
     *
     * @param object
     *            the target of the switch.
     * @return the result of interpreting the object as an instance of '
     *         <em>Shape</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseShape(final Shape object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '
     * <em>Gradient Shape</em>'. <!-- begin-user-doc --> This implementation
     * returns null; returning a non-null result will terminate the switch. <!--
     * end-user-doc -->
     *
     * @param object
     *            the target of the switch.
     * @return the result of interpreting the object as an instance of '
     *         <em>Gradient Shape</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseGradientShape(final GradientShape object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '
     * <em>Line</em>'. <!-- begin-user-doc --> This implementation returns null;
     * returning a non-null result will terminate the switch. <!-- end-user-doc
     * -->
     *
     * @param object
     *            the target of the switch.
     * @return the result of interpreting the object as an instance of '
     *         <em>Line</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseLine(final Line object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '
     * <em>Connector</em>'. <!-- begin-user-doc --> This implementation returns
     * null; returning a non-null result will terminate the switch. <!--
     * end-user-doc -->
     *
     * @param object
     *            the target of the switch.
     * @return the result of interpreting the object as an instance of '
     *         <em>Connector</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseConnector(final Connector object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '
     * <em>Comment</em>'. <!-- begin-user-doc --> This implementation returns
     * null; returning a non-null result will terminate the switch. <!--
     * end-user-doc -->
     *
     * @param object
     *            the target of the switch.
     * @return the result of interpreting the object as an instance of '
     *         <em>Comment</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseComment(final Comment object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '
     * <em>Comment Link</em>'. <!-- begin-user-doc --> This implementation
     * returns null; returning a non-null result will terminate the switch. <!--
     * end-user-doc -->
     *
     * @param object
     *            the target of the switch.
     * @return the result of interpreting the object as an instance of '
     *         <em>Comment Link</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseCommentLink(final CommentLink object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '
     * <em>Grid</em>'. <!-- begin-user-doc --> This implementation returns null;
     * returning a non-null result will terminate the switch. <!-- end-user-doc
     * -->
     *
     * @param object
     *            the target of the switch.
     * @return the result of interpreting the object as an instance of '
     *         <em>Grid</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseGrid(final Grid object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '
     * <em>Ruler</em>'. <!-- begin-user-doc --> This implementation returns
     * null; returning a non-null result will terminate the switch. <!--
     * end-user-doc -->
     *
     * @param object
     *            the target of the switch.
     * @return the result of interpreting the object as an instance of '
     *         <em>Ruler</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseRuler(final Ruler object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '
     * <em>Guide</em>'. <!-- begin-user-doc --> This implementation returns
     * null; returning a non-null result will terminate the switch. <!--
     * end-user-doc -->
     *
     * @param object
     *            the target of the switch.
     * @return the result of interpreting the object as an instance of '
     *         <em>Guide</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseGuide(final Guide object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '
     * <em>Element Entry</em>'. <!-- begin-user-doc --> This implementation
     * returns null; returning a non-null result will terminate the switch. <!--
     * end-user-doc -->
     *
     * @param object
     *            the target of the switch.
     * @return the result of interpreting the object as an instance of '
     *         <em>Element Entry</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseElementEntry(final Map.Entry<View, Alignment> object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '
     * <em>EObject</em>'. <!-- begin-user-doc --> This implementation returns
     * null; returning a non-null result will terminate the switch, but this is
     * the last case anyway. <!-- end-user-doc -->
     *
     * @param object
     *            the target of the switch.
     * @return the result of interpreting the object as an instance of '
     *         <em>EObject</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject)
     * @generated
     */
    @Override
    public T defaultCase(final EObject object) {
        return null;
    }

} // DiSwitch
